package com.d3works.apps.supplychain.service;

import com.d3works.apps.base.db.Partner;
import com.d3works.apps.purchase.db.PurchaseOrder;
import com.d3works.apps.sale.db.SaleOrder;
import com.d3works.apps.sale.db.SaleOrderLine;
import com.d3works.exception.D3worksException;
import com.google.inject.persist.Transactional;
import java.util.List;
import java.util.Map;

public interface SaleOrderPurchaseService {

  public void createPurchaseOrders(SaleOrder saleOrder) throws D3worksException;

  public Map<Partner, List<SaleOrderLine>> splitBySupplierPartner(
      List<SaleOrderLine> saleOrderLineList) throws D3worksException;

  @Transactional(rollbackOn = {Exception.class})
  public PurchaseOrder createPurchaseOrder(
      Partner supplierPartner, List<SaleOrderLine> saleOrderLineList, SaleOrder saleOrder)
      throws D3worksException;
}
